Repository navigation
Refuse to encrypt to more recipient stanzas than a header holds - #151
Merged
Merged
Conversation
A header holds at most 1024 recipient stanzas: go-age reads no more, and neither does AgeSharp by default. AgeSharp still wrote more, a file it then refused to read. go-age refuses to write one since v1.4.0 (2fceb23). Encrypting to more is now an AgeException, by every way of encrypting and before anything is written. More than 1024 recipients are refused before any of them is asked to wrap, so no plugin is started for a file that will not be written; fewer recipients that write too many stanzas between them are refused once they have.
…za-limit-on-write
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=======================================
Coverage 97.72% 97.72%
=======================================
Files 78 78
Lines 5092 5096 +4
Branches 697 699 +2
=======================================
+ Hits 4976 4980 +4
Misses 70 70
Partials 46 46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the differences from go-age 1.4.0 found in #150.
The problem
A header holds at most 1,024 recipient stanzas: go-age reads no more, and neither does AgeSharp unless
AgeDecryptOptions.MaxRecipientStanzasis raised. AgeSharp still wrote more. Encrypting to 1,025 recipients succeeded, and reading the file back failed withheader contains more than 1024 recipient stanzas. go-age refuses to write such a header since v1.4.0 (2fceb23).The change
Encrypting to more than 1,024 recipient stanzas is an
AgeException, checked where every encrypt path builds its header (Recipients.BuildHeader), so before anything reaches the caller's streams.too many recipients: 1025, and a header holds at most 1024 recipient stanzas.too many recipient stanzas: a header holds at most 1024.The limit when writing is fixed at go-age's value. A reader given a higher limit does not change what AgeSharp writes. No public API changes.
Tests
StanzaLimitOnWriteTests, 13 cases; 11 failed before the change.Encrypttwice,EncryptAsync,EncryptReader,EncryptWriter,EncryptDetached,EncryptDetachedAsync), at the call, with nothing written to either stream.Both suites pass locally in the default and the portable build, apart from the
age-keygeninterop test that #150 fixes (the local go-age is 1.4.0, and this branch does not have that fix).